<!DOCTYPE html>
<html>
	<head>
		<title></title>
		<meta charset="UTF-8">
  <!-- Tell the browser to be responsive to screen width -->
  <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
  <!-- Bootstrap 3.3.6 -->
  <link rel="stylesheet" href="/static/adminlte/bootstrap/css/bootstrap.min.css">
  <!-- Font Awesome -->
  <link rel="stylesheet" href="/static/css/font-awesome.min.css">
  <!-- Ionicons -->
  <link rel="stylesheet" type="text/css" href="/static/css/ionicons.min.css" />
  <!-- Theme style -->
  <link rel="stylesheet" href="/static/adminlte/dist/css/AdminLTE.min.css">
  <link rel="stylesheet" type="text/css" href="/static/umeditor/themes/default/css/umeditor.css"/>
  <link rel="stylesheet" href="/static/webuploader-0.1.5/webuploader.css"/>
	</head>
	<body>

<section class="content">
			<div class="row">
				<div class="col-xs-12">

					<form action="{{ route('admin.goods.add') }}" method="post" class="form-horizontal myform">

						<div class="nav-tabs-custom">
							<ul class="nav nav-tabs">
								<li class="active">
									<a href="#tab_1" data-toggle="tab">
										商品添加
									</a>
								</li>
								<li>
									<a href="#tab_2" data-toggle="tab">
										规格
									</a>
								</li>

							</ul>
							<div class="tab-content">
								<div class="tab-pane active" id="tab_1">

									<div class="form-group">
										<label class="col-sm-2 control-label">商品分类</label>

										<div class="col-sm-10">
											<select name="cat_id" class="form-control">
												<option value="0">一级菜单</option>
												@foreach($cate_list as $v)
												<option value="{{ $v['id'] }}" >{{ $v['html'].$v['name'] }}</option>
												@endforeach
											</select>
										</div>
									</div>
									<div class="form-group">
										<label class="col-sm-2 control-label">商品名称</label>

										<div class="col-sm-10">
											<input class="form-control" name="goods_name" placeholder="" value="" type="text">
										</div>
									</div>
									<div class="form-group">
										<label class="col-sm-2 control-label">商品价格</label>
										<div class="col-sm-10">
											<input class="form-control" name="shop_price" placeholder="" value="" type="text">
										</div>
									</div>
									<div class="form-group">
										<label class="col-sm-2 control-label">成本价</label>
										<div class="col-sm-10">
											<input class="form-control" name="cost_price" placeholder="" value="" type="text">
										</div>
									</div>
									<div class="form-group">
										<label class="col-sm-2 control-label">商品排序</label>
										<div class="col-sm-10">
											<input class="form-control" name="sort" placeholder="" value="100" type="text">
										</div>
									</div>
									<div class="form-group">
										<label class="col-sm-2 control-label">图片</label>
										<div class="col-sm-10">
											<input type="text" name="original_img" value="" id="thumb" style="display: none;">
											<div id="fileList" class="uploader-list"></div>
											<div id="filePicker">
												选择图片
											</div>
										</div>
									</div>
									<div class="form-group">
										<label class="control-label col-md-2">商品状态</label>
										<div class="col-md-7">
											<label class="radio-inline">
											<input name="is_on_sale" type="radio" value="1" checked="checked">
											<span>上架</span></label>
											<label class="radio-inline">
											<input name="is_on_sale" type="radio" value="-1">
											<span>下架</span></label>
										</div>
									</div>
									<div class="form-group">
										<label class="col-sm-2 control-label">详情</label>
										<div class="col-md-10">
											<!-- 加载编辑器的容器 -->
											<script type="text/plain" id="myEditor" name="goods_content" style="width:100%;height:240px;"></script>
										</div>
									</div>
								</div>
								<!-- /.tab-pane -->
								<div class="tab-pane" id="tab_2">
									<div class="form-group">
										<label class="col-sm-2 control-label">商品类型</label>
										<div class="col-sm-10">
											<select id="goods_type" name="spec_type" class="form-control">
												<option value="0">选择商品类型</option>
												@foreach($goods_type_list as $v)
												<option value="{{ $v['id'] }}">{{ $v['name'] }}</option>
												@endforeach
											</select>
										</div>
									</div>
									<div class="form-group">
										<label class="col-sm-2 control-label">商品规格</label>
										<div id="spec-box" class="col-sm-10"></div>
									</div>
									<div id="abc"></div>
								</div><!-- /.tab-pane -->
							</div><!-- /.tab-content -->
						</div>
						<div class="box-footer">
							<div class="col-sm-2">
								<input type="hidden" name="_token" value="{{csrf_token()}}">
								<button type="submit" class="btn btn-block btn-danger">保存</button>
							</div>
							<div class="col-sm-2">
								<button type="button" class="btn btn-block btn-default" onclick="history.go(-1)">取消</button>
							</div>
						</div>
					</form>
				</div><!--/.row-->
			</div>
		</section>
<!-- jQuery 2.2.3 -->
<script src="/static/adminlte/plugins/jQuery/jquery-2.2.3.min.js"></script>
<!-- 配置文件 -->
<script type="text/javascript" src="/static/umeditor/umeditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="/static/umeditor/umeditor.min.js"></script>
<!-- 实例化编辑器 -->
<script type="text/javascript">
    var um = UM.getEditor('myEditor');
</script>
	
<script src="/static/webuploader-0.1.5/webuploader.js" type="text/javascript" charset="utf-8"></script>
<script src="/static/layer/layer.js" type="text/javascript" charset="utf-8"></script>
<!-- Bootstrap 3.3.6 -->
<script src="/static/adminlte/bootstrap/js/bootstrap.min.js"></script>
<script src="/static/js/admin.js?123"></script>
<script src="/static/js/upfile.js?123"></script>
<script type="text/javascript">
	
$(function(){
	
	$("select#goods_type").change(function(){
		$("#abc").html('');
		var type_id = $(this).val();
		$.ajax({
			type:"get",
			url:"{{ route('admin.goods.getspectpl') }}",
			data:{
				type_id:type_id
			},success:function(info){
				$("#spec-box").html(info);
			}
		});
	})
	
})
</script>
	</body>
</html>
